﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Zone;
namespace sendcloud桌面版
{
    public partial class SetPara : Form
    {
        public SetPara()
        {
            InitializeComponent();
        }

     

        private void button1_Click(object sender, EventArgs e)
        {
            string s1 = textBox1.Text;
            string s2 = textBox2.Text;
            string s3 = textBox3.Text;
            string s4 = textBox4.Text;

            try
            {
                AppConfig.ConfigSetValue("app", "api_user", s1);
                AppConfig.ConfigSetValue("app", "api_key", s2);
                AppConfig.ConfigSetValue("app", "from", s3);
                AppConfig.ConfigSetValue("app", "fromname", s4);

                MessageBox.Show("修改成功！");
                this.Close();
                this.Dispose();
            }
            catch (Exception)
            {
                
                throw;
            }
              

        }
        private void SetPara_Load(object sender, EventArgs e)
        {
            SetDefalutPara();
        }
        void SetDefalutPara()
        {
            try
            {
                textBox1.Text = AppConfig.ConfigGetValue("app", "api_user");
                textBox2.Text = AppConfig.ConfigGetValue("app", "api_key");
                textBox3.Text = AppConfig.ConfigGetValue("app", "from");
                textBox4.Text = AppConfig.ConfigGetValue("app", "fromname");

            }
            catch (Exception)
            {
                
                throw;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";

        }
    }
}
